package edu.xidian.sselab.cloudcourse.controller;

import edu.xidian.sselab.cloudcourse.domain.test6_entity;
import edu.xidian.sselab.cloudcourse.repository.test6_Repository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.IOException;
import java.util.List;
@Controller
public class test6_controller {
    @Autowired
    private test6_Repository test6_repository;

    @RequestMapping("/test6")
    public String test6_try(Model model) throws IOException {

        List<test6_entity> recordList = test6_repository.find();

        System.out.println("以下是各国系轿车的总销售量：");
        for(test6_entity t:recordList){
            System.out.println(t);
        }
        model.addAttribute("title", "各系轿车总销量占比");
        return "test6";
    }

    @RequestMapping("/test22")
    public @ResponseBody
    List test6_try2() throws IOException {

        List<test6_entity> recordList = test6_repository.find();

        System.out.println("以下是各国系轿车的总销售量：");
        for(test6_entity t:recordList){
            System.out.println(t);
        }
        return recordList;
    }

}
